1. signal management 1

正如我在上一个视频中告诉您的那样,现在我们将从机器中休息一下,然后开始开发将在机器项目中使用的新组件。
So as I told you in the last video, right now, we will take a break from the machine and we will start developing a new component that we will use in the machine project.

该组件称为信号管理器,将用于管理账单和机器的所有信号。
This component is called the signal manager and will be used to manage all the signals for the bills, for the machine.

通过信号,我的意思是所有警报都会发出可能的警告和需要向最终用户显示的消息。
And by signal, I mean all the alarms sound possible warnings and messages that needs to be displayed to end user.

因此,我们希望创建一种有效的方法来记住它们、展示它们、展示它们,甚至重置它们。
So we want to create an effective method to memorize them, to show them and to display them and and even to reset them.

那么让我们从创建一个新项目开始。
So let's start by creating a new project.

我们将其称为信号管理标准项目。
We will call this a signal management as a standard project.

我们会的。
And we will.

始终使用我们的标准设备和该文本中的主程序。
Always use our standard device and the main program in that text.

好的,让我们在应用程序上创建一个文件夹,我们将其称为信号管理。
OK, so let's create on our application a folder that we will call a signal management.

在这个文件夹中,我们将放置与信号管理器有关的所有内容。
And in this folder, we will place everything that concerns our signal managers.

因此,让我们在此处创建另一个文件夹,我们将在其中调用数据类型,最终将在其中放置用户定义的数据类型。
So let's create another folder here that we will call data types in which we will place eventually a user defined data types.

让我们首先思考我们想要什么。
And let's start by thinking about what we want.

因此,我们的功能块的目标是感受全局信号列表。
So the goal of our function block will be to to feel a global signal list.

信号列表需要向用户提供他需要的所有信息。
The signals list will need to provide the user all the information that he needs.

意思是,嗯,什么类型的信号是活跃的,有多少信号是活跃的以及它们的列表。
Meaning um, what kinds of ah of signals are active, how many signals are active and a list of them.

因此,为了做到这一点,我们首先需要实际定义一些东西。
So in order to do so first we need to actually define a few things.

让我们定义什么是信号以及信号所需的所有信息。
Let's define what is a signal and all the information that are needed for a signal.

因此,为了做到这一点,我们将创建一个结构。
So in order to do this, we will create a structure.

因此,让我们添加一个对象和数据类型文件夹。
So let's add an object and data types folder.

呃,UTI,类型是结构,我们称之为信号。
Uh, the UTI, the type is structure and let's call this signal.

因此,让我们添加一个前缀写作 estie。
So let's add a prefix writing estie.

所以说这个信号。
So say this signal.

让我们考虑一下信号所需的一切,我们需要一个名称。
And let's think about all we need for our signal, we will need a name.

有一个字符串,指的是应该向用户显示的消息,当这个字符串时,当信号出现时,当信号发生时。
There is a string that refers to the message that should be displayed to the user when this when the string, when the signal appears, when the signal occurs.

所以我们将调用这个信号名称,这应该是一个字符串。
So we will call this signal name and this should be a string.

我们还需要信号有一个唯一的 ID。
We will also need for the signal to have an and unique ID.

所以说是这样的。
So that's right.

信号 ID
Signal I.D.

那是侧面的整数。
that is on the side integer.

然后我们还添加 Anne Boleyn,它会告诉我们信号是否有效,例如,这可能是一个故障,假设禁用我们活塞设备的反馈传感器 Folta。
And then let's also add Anne Boleyn that will tell us if the signal is active or not, for instance, this may be a fault, let's say disable feedback sensor Folta for our piston device.

这样的话我们实际上就有了这个,呃,有这个信息。
In this way, we will actually have this, uh, have this information.

然后,我们还需要确定我们有什么样的信号 c。
Then also, we will need to determine what kind of c of signal do we have.

因此,让我们创建,呃,新的数据类型,这次将是一个枚举中的枚举,您将其称为 noom 信号类型。
So let's create, uh, new data type and this time will be an enumerated in enumeration that you would call a noom signal type.

因此,对于我们的信号类型,我希望有,嗯,不同类型的信号。
So for our signal types, I would like to have, um, different types of signals.

假设我们可以有一个消息信号。
Let's say that we can have a message signal.

这么说吧,这等于 10,一个警告信号。
And this let's say this, this is equal to 10, a warning signal.

这些是不同类别的信号,然后警报等于 30。
These are different class classes of signals and then the alarm equal to 30.

让我们在信号中为我们的枚举和此处添加一个非字段。
And let's add also a non field for our enumerated and here in the signal.

我们这里还有,呃,信号类型,它的类型将是,嗯,信号类型,所以我们实际上可以,嗯,仅使用一个令人讨厌的信号,呃,结构来定义我们需要的所有信号。
Let's also had here, uh, signal type of and its type will be and, um, signal type so we can actually, um, define all of the signals that we need using only a nasty signal, uh, structure.

因此,无论何时,我们都需要一份 FBI 感受到的信号列表。
So whenever we are, we will need a list of these signals that our FBI will feel.

因此,我们将能够获得有关有多少信号正在起作用以及它们是什么类型的信息。
So we are we will be able to have the information on how many signals are acting and what kind of signals are they.

现在,让我们考虑一下我们需要的实际信号列表。
So right now, let's think about the the actual signal lists that we need.

那么让我们创建另一个结构,我将用 A 再次调用它。
So let's create another structure that I will call again with A.

St 作为信号列表的前缀。
S t prefix as the signal list.

因此,通过这种方式,我们首先考虑单个列表中需要的所有细节。
So in this way, let's first let's think of all the the detail that we need in our single list.

好吧,我们需要有效地拥有一个真正的活动信号列表。
Well, we will need to have effectively a really a list of the active signals.

因此,让我们在这里创建一个主动的语言信号。
So let's create here, let's say, an active signals verbal.

应该有一个数组。
There should be an array.

对于这些信号,让我们现在在这里补充一下,呃,通用化,让我们看看我们不能允许 20 个活动信号在这些信号发出信号的同时关闭。
Of as these signals, so let's add that for now here, uh, genericized, let's see that we cannot we can allow 20 active signals at the same time off as these signals signal.

因此,在此列表中,我们需要显示当前所有活动的信号。
So in this list, we will need to display all the signals that are active at the moment.

然后让我们添加一些有用的附加信息。
Then let's add some additional information that will be useful.

我们需要知道是否有任何活跃的警报,这应该是一个 Bollon 变量,任何活跃的警告以及任何活跃的消息。
We need to know if there are any alarms active and this should be a Bollon variable, any warnings active and let's say any messages active.

然后我们需要知道有多少个警报是活动的,所以这里是活动警报的数量,应该小于警报,这里的所有内容都应该分配给整数,还有活动警告的数量。
Then we will need to know how many alarms are active, so this right here, number of active alarms that should be less alarm, everything here that should be assigned to integer, the number also of active warnings.

那是一个整数。
That is an integer.

以及活跃消息的数量,这应该是一个答案。
And the number of active messages, that should be an answer.

然后我们还可以添加一年的信号总数。
And then we could also add a year the total number of signals.

这只是警报、警告和消息的总和。
That will just be the sum of the alarms, warnings and messages.

因此,让我们写下今年的活跃信号数量。
So let's write this year number of active signals.

好的,所以我们需要有一个该列表的实例,该实例将由我们的功能块填充。
OK, so we will need to have one instance of this list that will be filled by our function block.

因此,让我们在信号管理文件夹中创建一个全局变量列表。
So let's create here in the signal management folder a global variable list.

我们将这称为 Gvul 下划线信号管理。
And this will we will call this Gvul underscore signal management.

这里是一些限定的唯一属性,我们将,呃,呃,我们将其称为全局信号列表,并且类型应该是信号列表。
And here are some of the qualified only attribute we will just, uh, uh, place let's call this a global signal list and the type should be a signal list.

所以我们要写的目的是要感受到这一点,并且软件中的所有组件都可以访问它,呃,为了看看是否有一些例外,有些,呃,处于活动状态的警报。
So the purpose is there to the out there be that we are going to write is going to feel this and all the components in the software may be able to access it, uh, in order to see if there are some exceptions that some, uh, alarms that are active.

这就是我们将其全球化的原因。
And this is the reason why we are making it global.

所以我们将在这里获得信号列表,所以让我们开始创建我们的功能块,对吗?
So we will have here our signal lists, so let's start creating our function block, are we right?

单击文件夹和信号管理文件夹,让我们创建一个函数。
Click on the folders and signal management folder and let's create a function.

查看结构,输入我们称之为“抱歉”的语言。
Look in the structure, text the language that we will call sorry, here.

FP 强调信号管理。
FP underscore signal management.

这个 FBI 肯定会有一个信号列表作为输出,给您的一个建议是,当处理像这样的非常大的结构时,因为这里我们有一个结构数组和许多其他字段。
This FBI will surely have a signal list as an output bartter one suggestions for for you is that when are dealing with very big structures such as this, because here we have an array of structures and many other fields.

建议您不要使用 AVAR 输出,因此您不应在此处放置信号列表。
A suggestion is that you should not use the AVAR output, so you should not place a signal list here.

所以我们现在就这样写,因为当你,嗯,当你使用输出变量时,你总是会在输出上写入副本。
So let's write this for now, because when you, um, when you use an output variable, you will always write the copy on your output.

因此,如果您使用非常大的结构,可能需要相当多的计算时间。
So if you're using very big structures, it may take quite a bit of computational time.

因此,建议使用 in out 而不是 asset,即使您不想从外部写入它们。
So the suggestion is to use instead of the asset is to use the in out, even if you're not meaning to write them from the outside.

这,呃,很有用,因为结构是通过引用传递的,而不是通过,嗯,不是它们不复制。
This is, uh, is useful because the the structures are passed by reference and not not by, um, not they are not making copies.

这需要时间。
That takes time.

所以我们这里有我们的信号列表。
So we will have here our signal lists.

该功能块的目标是应该为我们想要处理的每个信号调用它。
And the goal of this function block is that it should be called for every signal that we want to process.

因此,我们需要知道每个 PEOC 周期的每个信号,呃,是 I.D。
So we will need to know for every signal at every PEOC cycle, uh, is I.D.

姓名等。
name and so on.

以及它是否活跃。
And if it is active or not.

为此,我们现在将添加一些输入。
And in order to do so, we will add that right now some inputs.

因此,该函数将在 HPLC 循环中被多次调用,并且它将处理,呃,每个信号一次。
So this function will be called the many times at HPLC cycle and it will process, uh, every signal once.

因此,对于输入变量,我们需要向其发送有关信号的所有信息。
So for the input variables, we need to send it all the information regarding the signal.

第一个是,呃,最重要的是知道信号是否有效。
And the the first one is that is, uh, the most important one is to know if the signal is active.

因此,如果我们谈论警报,如果警报处于活动状态,被触发并且这是不可行的,我们将需要信号名称。
So if we are talking about an alarm, if the alarm is active, is triggered and this is about inviable, we'll need the signal name.

作为一个字符串。
As a string.

我们需要节日信号 ID 中的所有内容作为无符号整数,我们需要知道在这里键入的类型作为警报信号类型,然后我们需要添加一个重置信号来重置可能的和然后是信号,显示发送端的输入。
We needed all the things that are in the festive signals ID as an unsigned integer, we will need to know the type to type here as an alarm signal type, and then we will need to have to add a reset signal to reset a possible and then the signal, the display sender input.

我们还需要知道信号是否需要自动重置,一旦信号活动变为假。
And also we will need to know if the signal automatically it needs to be reset that once the signal active becomes false.

所以我们必须听到自动重置的声音,我稍后会向您描述。
So we will have to hear an auto reset, feel that I will describe to you later on.

所以这个函数的目标,Glocke,就是这个,所以让我们删除这个 Piercey 派对,并创建一个主要的 Yolŋu,让我们用肢体语言称之为主要,呃,。
So the goal of this function, Glocke, is this here, so let's remove this Piercey party and let's create a main Yolŋu, let's call this main and, uh, in body language.

所以这里的目标,假设我们的主程序中有信号管理功能块,我们将其称为 B 类信号管理的信号管理。
So the goal here, let's say that we have here in our main program, the signal management function block, and we'll call this signal management of the type B signal management.

目前,联邦调查局空无一人,所以巴伦没有遗嘱。
Right now, the FBI is empty, so no will will with Barun.

但我只是想向您展示实施是什么。
But I just want to show you what the implementation is, is about.

因此,如果我给这位高级管理层打电话,请让我到这里。
So if I place a call to this senior management, have me here.

在这里我将放置我们的全局信号列表,所以我们的全局信号列表。
Here I will place our global signal list, so our global signal list.

这个列表将由信号管理编写,现在我需要为每个信号调用它,所以。
And this list will be written by the signal management now I need to call this for every single signal, so.

在这里,例如,如果一个著名的警报呼叫,我们称之为,例如,Beston 警报一,我将需要连接到负责此处活塞信号警报信号的变量。
Here I will, for instance, if a renowned calling for an alarm, let's call this, for instance, Beston alarm one here, I will need to connect to the variable that is responsible for the signal for the piston signal alarm here.

我将独特地降落到这里。
I will descend uniquely here.

我会告诉你这个信号是警报。
I will tell that this signal is an alarm.

抱歉,我需要进入一个房间并仅删除合格的人员。
Sorry, this I need to go here into a room and remove the qualified only.

杂注。
Pragma.

在这里,我需要连接一个我现在在这里创建的重置按钮,在这里我需要告诉警报是否需要在信号消失时自动重置。
Here, I will need to connect, let's say, a reset button that I create here for now and here I will need to tell if the alarm needs to automatically reset when the signal disappears.

所以我们的目标是,让我们上网进行第二次模拟。
So the goal, let's go online for a second simulation.

目标?
The goal?

抱歉,我没有在这里安排主程序,需要将其拖到我们的主任务下,现在我们上线吧。
Sorry, I didn't schedule the main program here and need to drag it under our main task and now let's go online.

这里的目标是,当系统在这里运行时,我们将拥有我们的全局变量全局信号系统,即每当我这个信号活动通过时,这个异常需要由FBI处理,因此需要一个新的信号以渐进方式出现在我们的活动信号列表中。
The goal here is that when the system is running here, we will have our global variable global signal system, which is that whenever I this signal activity becomes through, this exception needs to be processed by the FBI and therefore a new signal needs to be had here in our list of active signals in the progressive way.

在这里,它需要在这里添加它,它需要它,呃,连贯地填写所有这些信息,其他市场将需要受到控制,因为这是一个警报。
Here, it will need to add it here, it will need it to, uh, to coherently fill all this information, the other markets will need to become controlled because this this is an alarm.

活动信号的数量需要增加 1。
The number of active signals will need to increase by one.

活动警报的数量也需要增加 1。
And the number of active alarms needs to increase by one as well.

然后需要重置为true。
Then would need to reset equal to true.

如果变成 Forsa,则需要从列表中删除该信号,并且所有变量都需要相应更改。
If this becomes Forsa, the signal needs to be removed from the list and all the variables need to change accordingly.

相反,如果我们有一个现在重置设置为强制,我们需要发生的是,呃,唯一会导致,呃,信号从我们的列表中消失的条件就是,呃,重置输入等于为真。
Instead, if we have a now to reset set to force, what we need to happen is that, uh, the only condition that will that will lead the, uh, the signal to disappear from our list is just, uh, reset input equal to true.

所以这意味着如果发生异常,就会发生警报,​​所以这就成立了,这里需要出现警报。
So this means that if the exception occurs, the alarm occurs, so this becomes true, an alarm needs to appear here.

如果这变为假,警报需要保持在那里,直到我们重置。
If this becomes false, alarm needs to remain there until we get a reset.

然后我们还需要对这个列表进行排序,我们的目标是按优先级对它们进行排序,也就是说我们的武器比警告具有更大的优先级,警告比信息具有更大的优先级。
Then we also need to sort this list, and our goal is to sort them by, let's say, priority, saying that our arms have a bigger priority than warnings and warnings have a bigger priority than informations.

因此,如果弹出警报,它需要弹出并出现在警告和信息之前的正确位置。
So if if an alarm pops up, it needs to pop up to appear in the correct position right before the warnings and the information.

我们需要尽快解决这个问题。
And we need to manage that soon.

在下一个视频中,我们将开始为信号管理功能块编写实际代码。
The next video, we will start writing the actual code for our signal management function block.